<template>
  <div class="testRecord">
    <div class="searchDiv">
      <Form :model="searchItem" :label-width="90">
        <Row :gutter="10">
          <Col span="6">
            <FormItem label="电站">
              <Select v-model="searchItem.powerStation" clearable filterable @on-change="getHd">
                <Option
                  v-for="(item, index) in powerStationList"
                  :value="item"
                  :key="index"
                >{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="HD编号">
              <Select
                v-model="searchItem.hdNumber"
                clearable
                filterable
                :disabled="HBnumberList.length == 0"
                @on-change="getJz"
              >
                <Option v-for="(item, index) in HBnumberList" :value="item" :key="index">{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="机组编号">
              <Select
                v-model="searchItem.aircrewNumber"
                clearable
                filterable
                :disabled="JZnumberList.length == 0"
              >
                <Option v-for="(item, index) in JZnumberList" :value="item" :key="index">{{ item }}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="试验日期">
              <DatePicker
                type="datetime"
                v-model="searchItem.experimentDate"
                @on-change="time1"
                 format="yyyy-MM-dd HH:mm:ss"
                placeholder="选择日期"
                style="width: 100%"
              ></DatePicker>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="试验代码">
              <Input v-model="searchItem.experimentCode" placeholder="请输入"></Input>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="记录人">
               <Select v-model="searchItem.recordName" clearable filterable>
                          <Option v-for="(item, index) in peopleList" :value="item.trueName" :key="index">{{item.trueName}}</Option>
                      </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="记录时间">
              <DatePicker
                type="datetime"
                v-model="searchItem.recordTime"
                placeholder="记录时间"
                @on-change="time2"
                 format="yyyy-MM-dd HH:mm:ss"
                style="width: 100%"
              ></DatePicker>
            </FormItem>
          </Col>
          <Col span="12">
            <Button type="primary" class="marRight" @click="searchItem.pageNo=1;getDataList()">查询</Button>
            <Button type="success" class="marRight" @click="formItem={};qxList=[];csList=[];add()">新增记录</Button>
            <Button type="info" class="marRight">导入Excel</Button>
            <Button type="primary" @click="down">导出Excel</Button>
          </Col>
        </Row>
      </Form>
    </div>
    <!-- <div class="chart">
      <Form :model="searchItem" :label-width="90">
        <Row :gutter="10">
          <Col span="6">
            <FormItem label="电站">
              <Select v-model="searchItem.powerStation" clearable filterable>
                  <Option v-for="(item, index) in powerStationList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
              </Select>
            </FormItem>
           </Col>
          <Col span="6">
            <FormItem label="机组编号">
               <Select v-model="searchItem.aircrewNumber" clearable filterable>
                  <Option v-for="(item, index) in JZnumberList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
            <FormItem label="参数名称">
              <Select v-model="searchItem.aircrewNumber" clearable filterable>
                  <Option v-for="(item, index) in JZnumberList" :value="item.displayName" :key="index">{{item.displayName}}</Option>
              </Select>
            </FormItem>
          </Col>
          <Col span="6">
              <Button type="primary">加入对比</Button>
          </Col>
        </Row>
      </Form>
      <div id="myChart"  :style="{width: '100%', height: '400px'}">

      </div>
    </div> -->
    <Table style="margin-top:10px;" border :columns="columns" :data="tableData" :loading="loading"></Table>
    <Page show-total :total="total" :current="searchItem.pageNo" :page-size="pageSize" @on-change="changePage"  style="margin:20px auto;text-align:center"/>
    <!-- 新增弹窗开始 -->
    <Modal :mask-closable="false" v-model="modal1" :title="title1" width="1000" >
      <div class="baseTitle">基本信息</div>
           <Form :label-width="100">
             <Row :gutter="10" class="xzjz">
                 <Col span="8">
                    <FormItem :model="formItem" label="电站：">
                     <Select v-model="formItem.powerStation" clearable filterable @on-change="getHd">
                        <Option v-for="(item, index) in powerStationList" :value="item" :key="index">{{item}}</Option>
                    </Select>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="HD编号：">
                      <Select v-model="formItem.hdNumber" clearable filterable :disabled="HBnumberList.length==0" @on-change="getJz">
                        <Option v-for="(item, index) in HBnumberList" :value="item" :key="index">{{item}}</Option>
                    </Select>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="机组编号：">
                        <Select v-model="formItem.aircrewNumber" clearable filterable :disabled="JZnumberList.length==0" @on-change="getMode">
                          <Option v-for="(item, index) in JZnumberList" :value="item" :key="index">{{item}}</Option>
                      </Select>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="型号：">
                      {{formItem.model}}
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="试验日期：">
                      <DatePicker
                      type="datetime"
                      @on-change="time3"
                         format="yyyy-MM-dd HH:mm:ss"
                      v-model="formItem.experimentDate"
                      placeholder="选择日期"
                      style="width: 100%"
                    ></DatePicker>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="试验代码：">
                      <Input v-model="formItem.experimentCode" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
             </Row>
           </Form>
           <div class="baseTitle">试验问题</div>
           <Form :label-width="80">
             <Row :gutter="10" class="xzjz">
                  <Col span="7">
                    <FormItem label="功能位置：">
                      <Input v-model="qxForm.location" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="异常情况：">
                      <Input v-model="qxForm.abnormalities" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="建议行动：">
                      <Input v-model="qxForm.suggestAction" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="3">
                    <Button type="default" @click="addQX"> 添加</Button>
                  </Col>
                   <Col span="24" style="margin-bottom:10px;">
                    <Table border :columns="columns2" :data="qxList"></Table>
                  </Col>
                  <div class="baseTitle">试验问题</div>
                  <Col span="7">
                    <FormItem label="参数组：">
                      <Input v-model="csForm.groupName" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="参数名称：">
                      <Input v-model="csForm.name" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="参数代码：">
                      <Input v-model="csForm.code" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="单位：">
                      <Input v-model="csForm.unit" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="参考值：">
                      <Input v-model="csForm.referenceValue" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="7">
                    <FormItem label="试验值：">
                      <Input v-model="csForm.experimentValue" placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="3">
                    <Button type="default" @click="addCS"> 添加</Button>
                  </Col>
                </Row>
                <Row :gutter="10" class="xzjz">
                  <Col span="24" style="margin-bottom:10px;">
                    <Table border :columns="columns3" :data="csList"></Table>
                  </Col>
                  <div class="baseTitle">填报信息</div>
                  <Col span="8">
                    <FormItem label="记录人：">
                      <!-- <Select @on-change="jiluName" v-model="formItem.recordId" label-in-value clearable filterable>
                          <Option v-for="(item, index) in peopleList" :value="item.id" :key="index">{{item.trueName}}</Option>
                      </Select> -->
                      <Input v-model="recordName" disabled placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
                  <Col span="8">
                    <FormItem label="记录时间：">
                      <!-- <DatePicker
                        type="datetime"
                        v-model="formItem.recordTime"
                        format="yyyy-MM-dd HH:mm:ss"
                         @on-change="time4"
                        placeholder="记录时间"
                        style="width: 100%"
                      ></DatePicker> -->
                       <Input v-model="recordTime" disabled placeholder="请输入"></Input>
                    </FormItem>
                  </Col>
             </Row>
           </Form>
   <div slot="footer">
               <Button @click="modal1=false">取消</Button>
              <Button type="primary" :loading="btnClick" @click="ok">确定</Button>
          </div>



    </Modal>
    <Modal :mask-closable="false" v-model="delmodal1" width="360" class-name="vertical-center-modal" @on-ok="remove(delId1)">
        <p slot="header" style="color:#f60;text-align:center">
            <Icon type="ios-information-circle"></Icon>
            <span>确认删除</span>
        </p>

        <div style="text-align:center">
            <p>确认删除此数据么？</p>
        </div>
    </Modal>
    <Modal :mask-closable="false" v-model="delmodal2" width="360" class-name="vertical-center-modal" @on-ok="remove2(delIndex2,delId2)">
        <p slot="header" style="color:#f60;text-align:center">
            <Icon type="ios-information-circle"></Icon>
            <span>确认删除</span>
        </p>

        <div style="text-align:center">
            <p>确认删除此数据么？</p>
        </div>
    </Modal>
    <Modal :mask-closable="false" v-model="delmodal3" width="360" class-name="vertical-center-modal" @on-ok="remove3(delIndex3,delId3)">
        <p slot="header" style="color:#f60;text-align:center">
            <Icon type="ios-information-circle"></Icon>
            <span>确认删除</span>
        </p>

        <div style="text-align:center">
            <p>确认删除此数据么？</p>
        </div>
    </Modal>
    <!-- 新增弹窗结束 -->
  </div>
</template>

<script>
import {
  getSelectOption,
  getAllPeople,getTime,getAllEqu
} from '@/api/select'
import {
  getTableData,
  add,
  update,
  del,
  delQX,
  delCS,
  findQX,
  findCS,
  getEchart,downExcel
} from '@/api/testRecord'
export default {
  data() {
    return {
      btnClick:false,
      loading:true,
      recordName: localStorage.getItem('recordUserName'),
      recordId:localStorage.getItem('recordUserId'),
      recordTime:getTime(),
      delmodal1: false,
      delId1: 0,
      delmodal2: false,
      delIndex2: 0,
      delId2: 0,
      delmodal3: false,
      delIndex3: 0,
      delId3: 0,
      allEquList: [],
      allEquList2: [],
      peopleList:[],
      powerStationList:[],
      HBnumberList:[],
      JZnumberList:[],
      modal1: false,
      title1:'新增记录',
      total: 0,
      qxForm:{},
      qxList:[],
      csForm:{},
      csList:[],
      searchItem: {
        powerStation:"",
        aircrewNumber: "",
        experimentDate:"",
        experimentCode:"",
        recordName:"",
        recordTime:"",
        pageNo: 1,
        pageSize: 10
      },
      formItem: {

      },
      columns: [
        {
          type: "index",
          width: 60,
          title: "序号",
          align: "center"
        },
        {
          title: "电站",
          key: "powerStation"
        },
        {
          title: "HD编号",
          key: "hdNumber"
        },
        {
          title: "机组编号",
          key: "aircrewNumber"
        },
        {
          title: "试验日期",
          key: "experimentDate"
        },
        {
          title: "试验代码(PT)",
          key: "experimentCode"
        },
        {
          title: "记录人",
          key: "recordName"
        },
        {
          title: "记录时间",
          key: "recordTime",
          width:150
        },
        {
          title: "操作",
          key: "action",
          width: 150,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: "primary",
                    size: "small"
                  },
                  style: {
                    marginRight: "5px"
                  },
                  on: {
                    click: () => {
                     this.edit(JSON.stringify(params));
                    }
                  }
                },
                "编辑"
              ),
              h(
                "Button",
                {
                  props: {
                    type: "error",
                    size: "small"
                  },
                  on: {
                    click: () => {
                      this.openDel1(params.row.id)
                    }
                  }
                },
                "删除"
              )
            ]);
          }
        }
      ],
      tableData: [],
      columns2: [
        {
          title: "功能位置",
          key: "location"
        },
        {
          title: "异常情况",
          key: "abnormalities"
        },
         {
          title: "建议行动",
          key: "suggestAction"
        },
        {
          title: "操作",
          key: "action",
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: "error",
                    size: "small"
                  },
                  on: {
                    click: () => {
                      this.openDel2(params.index,params.row.id);
                    }
                  }
                },
                "删除"
              )
            ]);
          }
        }
      ],
      tableData2: [],
      columns3: [
        {
          title: "参数组",
          key: "groupName"
        },
        {
          title: "参数名称",
          key: "name"
        },
        {
          title: "参数代码",
          key: "code"
        },
        {
          title: "单位",
          key: "unit"
        },
        {
          title: "参考值",
          key: "referenceValue"
        },
        {
          title: "试验值",
          key: "experimentValue"
        },
        {
          title: "操作",
          key: "action",
          width: 200,
          align: "center",
          render: (h, params) => {
            return h("div", [
              h(
                "Button",
                {
                  props: {
                    type: "error",
                    size: "small"
                  },
                  on: {
                    click: () => {
                      this.openDel3(params.index,params.row.id);
                    }
                  }
                },
                "删除"
              )
            ]);
          }
        }
      ],
      tableData3: []
    };
  },
  methods: {
    down(){
      downExcel(this.searchItem).then(res => {
         const blob = new Blob([res], {type: 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;'});

        const ie = navigator.userAgent.match(/MSIE\s([\d.]+)/),
            ie11 = navigator.userAgent.match(/Trident\/7.0/) && navigator.userAgent.match(/rv:11/),
            ieEDGE = navigator.userAgent.match(/Edge/g),
            ieVer = (ie ? ie[1] : (ie11 ? 11 : (ieEDGE ? 12 : -1)));
        if (ie && ieVer < 10) {
            this.message.error('No blobs on IE<10');
            return;
        }
        if (ieVer > -1) {
            window.navigator.msSaveBlob(blob, '试验记录.xlsx');
        } else {
            const url = window.URL.createObjectURL(blob);
            let link = document.createElement('a');
            link.setAttribute('href', url);
            link.setAttribute('download', '试验记录.xlsx');
            document.body.appendChild(link);
            link.click();
            document.body.removeChild(link);
        }
      })
    },
    //获取所有人员
    getAllPeople(){
      getAllPeople(
        null
      ).then(res => {
        this.peopleList = res.data
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    // 获取电站类型列表
    // powerStation () {
    //   getSelectOption(
    //     {
    //       code: 'dianzhan'
    //     }
    //   ).then(res => {
    //     this.powerStationList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    // HBnumber () {
    //   getSelectOption(
    //     {
    //       code: 'hd_code'
    //     }
    //   ).then(res => {
    //     this.HBnumberList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    // JZnumber () {
    //   getSelectOption(
    //     {
    //       code: 'jizu_code'
    //     }
    //   ).then(res => {
    //     this.JZnumberList = res.data
    //   }).catch(err => {
    //     console.error('err>' + JSON.stringify(err))
    //   })
    // },
    jiluName(e){
      this.formItem.recordName=e.label
    },
    time1(e){
      this.searchItem.experimentDate = e
    },
    time2(e){
      this.searchItem.recordTime = e
    },
    time3(e){
      this.formItem.experimentDate = e;
      console.log(this.formItem.experimentDate,'试验时间')
    },
    time4(e){
      this.formItem.recordTime = e
    },
    addQX(){
      if(this.qxForm.location==''||this.qxForm.location==undefined){
        this.$Message.info('请填写功能位置！');
        return false;
      }
      if(this.qxForm.abnormalities==''||this.qxForm.abnormalities==undefined){
        this.$Message.info('请填写异常情况！');
        return false;
      }
      if(this.qxForm.suggestAction==''||this.qxForm.suggestAction==undefined){
        this.$Message.info('请填写建议行动！');
        return false;
      }
      this.qxList.push(this.qxForm);
      this.qxForm={};
    },
    addCS(){
      if(this.csForm.groupName==''||this.csForm.groupName==undefined){
        this.$Message.info('请填写参数组！');
        return false;
      }
      if(this.csForm.name==''||this.csForm.name==undefined){
        this.$Message.info('请填写参数名称！');
        return false;
      }
      if(this.csForm.code==''||this.csForm.code==undefined){
        this.$Message.info('请填写参数代码！');
        return false;
      }
      if(this.csForm.unit==''||this.csForm.unit==undefined){
        this.$Message.info('请填写单位！');
        return false;
      }
      if(this.csForm.referenceValue==''||this.csForm.referenceValue==undefined){
        this.$Message.info('请填写参考值！');
        return false;
      }
      if(this.csForm.experimentValue==''||this.csForm.experimentValue==undefined){
        this.$Message.info('请填写试验值！');
        return false;
      }
      this.csList.push(this.csForm);
      this.csForm={};
    },
    openDel1 (id) {
      this.delmodal1 = true
      this.delId1 = id
      // this.remove(params.index);
    },
    openDel2 (index,id) {
      this.delmodal2 = true
      this.delIndex2 = index;
      this.delId2 = id;
    },
    openDel3 (index,id) {
      this.delmodal3 = true
      this.delIndex3 = index;
      this.delId3 = id;
      console.log(this.delId3)
    },
    remove(id) {
      del({ id: id }).then(res => {
        if (res.code == 0) {
          this.$Message.info('删除成功')
          this.searchItem.pageNo=1
          this.getDataList()
        } else {
          this.$Message.info(res.message)
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    remove2(index,id) {
      this.qxList.splice(index, 1);
      // if(id){
      //   delQX({ id: id }).then(res => {
      //     if (res.code == 0) {
      //       this.$Message.info('删除成功');
      //       this.qxList.splice(index, 1);
      //     } else {
      //       this.$Message.info(res.message)
      //     }
      //   }).catch(err => {
      //     console.error('err>' + JSON.stringify(err))
      //   })
      // }else{
      //   this.qxList.splice(index, 1);
      //   this.$Message.info('删除成功');
      // }

    },
    remove3(index,id) {
      this.csList.splice(index, 1);
      console.log(id,'删除id')
      // if(id){
      //   delCS({ id: id }).then(res => {
      //     if (res.code == 0) {
      //       this.$Message.info('删除成功');
      //       this.csList.splice(index, 1);
      //     } else {
      //       this.$Message.info(res.message)
      //     }
      //   }).catch(err => {
      //     console.error('err>' + JSON.stringify(err))
      //   })
      // }else{
      //   this.csList.splice(index, 1);
      //   this.$Message.info('删除成功');
      // }

    },
    add () {
      this.title1 = '新增记录'
      this.modal1 = true
    },
    edit (params) {
      this.title1 = '编辑记录'
      this.formItem = JSON.parse(params).row
      this.modal1 = true
      findQX({experimentRecord:JSON.parse(params).row.id}).then(res => {
        if (res.code == 0) {
          this.qxList = res.data
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
      findCS({experimentRecord:JSON.parse(params).row.id}).then(res => {
        if (res.code == 0) {
          this.csList = res.data
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })

      this.allEquList2 = this.allEquList.filter(item => item.powerStation == this.formItem.powerStation);
      let arr2 = this.allEquList2.map(function(item) {
        return item.hdNumber;
      });
      this.HBnumberList = [...new Set(arr2)];

      let arr3 = this.allEquList2.filter(item => item.hdNumber == this.formItem.hdNumber);
      let arr4 = arr3.map(function(item) {
        return item.aircrewNumber;
      });
      this.JZnumberList = [...new Set(arr4)];
    },
    ok() {
      this.btnClick=true;
      this.formItem.recordName=this.recordName;
      this.formItem.recordId=this.recordId;
      this.formItem.recordTime=this.recordTime;
      let params=this.formItem;
      for(var i=0;i<this.qxList.length;i++){
        params["defectAddDtoList["+i+"].abnormalities"]=this.qxList[i].abnormalities;
        params["defectAddDtoList["+i+"].location"]=this.qxList[i].location;
        params["defectAddDtoList["+i+"].experimentRecordId"]=this.qxList[i].experimentRecordId;
        params["defectAddDtoList["+i+"].suggestAction"]=this.qxList[i].suggestAction;
        params["defectAddDtoList["+i+"].id"]=this.qxList[i].id;
      }
      for(var i=0;i<this.csList.length;i++){
        params["paramAddDtoList["+i+"].code"]=this.csList[i].code;
        params["paramAddDtoList["+i+"].experimentRecordId"]=this.csList[i].experimentRecordId;
        params["paramAddDtoList["+i+"].experimentValue"]=this.csList[i].experimentValue;
        params["paramAddDtoList["+i+"].groupName"]=this.csList[i].groupName;
        params["paramAddDtoList["+i+"].id"]=this.csList[i].id;
        params["paramAddDtoList["+i+"].name"]=this.csList[i].name;
        params["paramAddDtoList["+i+"].referenceValue"]=this.csList[i].referenceValue;
        params["paramAddDtoList["+i+"].unit"]=this.csList[i].unit;
      }
      if(params.id){
          delete params._index;
          delete params._rowKey;
          params.experimentDate=this.timeFormat(params.experimentDate);
          update(params).then(res => {
            if (res.code == 0) {
              this.$Message.info('编辑成功')
              this.getDataList()
              this.modal1=false;
              this.btnClick=false;
            } else {
              this.$Message.info(res.message)
              this.btnClick=false;
            }
          }).catch(err => {
            console.error('err>' + JSON.stringify(err))
          })
      }else{
          add(params).then(res => {
            if (res.code == 0) {
              this.$Message.info('新增成功')
              this.getDataList()
               this.modal1=false;
              this.btnClick=false;
            } else {
              this.$Message.info(res.message)
              this.btnClick=false;
            }
          }).catch(err => {
            console.error('err>' + JSON.stringify(err))
          })
      }
    },
    timeFormat (time) {
      if(time instanceof Date==false){
        return time
      }
                const dateTime = new Date(time)
                const year = dateTime.getFullYear()
                const month = this.addZero(dateTime.getMonth() + 1)
                const date = this.addZero(dateTime.getDate())
                const hour = this.addZero(dateTime.getHours())
                const minute = this.addZero(dateTime.getMinutes())
                const second = this.addZero(dateTime.getSeconds())
                return year+"-"+month+"-"+date+" "+hour+":"+minute+":"+second
            },
            addZero (v) {
                return v < 10 ? '0' + v : v
            },
    /** 分页 */
    changePage (pageNo) {
      this.searchItem.pageNo = pageNo
      this.getDataList()
    },
    getDataList () {
      getTableData(this.searchItem).then(res => {
        if (res.code == 0) {
          this.total = res.data.total
          this.tableData = res.data.list
          this.loading=false;
        }
      }).catch(err => {
        console.error('err>' + JSON.stringify(err))
      })
    },
    getEchartData(){
      getEchart().then(res => {
        if (res.code == 0) {
            console.log(res.data)
        }
      })
    },
    getAllEqument() {
      getAllEqu(null).then(res => {
        this.allEquList = res.data;
        let arr = res.data.map(function(item) {
          return item.powerStation;
        });
        this.powerStationList = [...new Set(arr)];
      });
    },
    getHd(e) {
      this.JZnumberList = [];
      this.allEquList2 = this.allEquList.filter(item => item.powerStation == e);
      let arr2 = this.allEquList2.map(function(item) {
        return item.hdNumber;
      });
      this.HBnumberList = [...new Set(arr2)];
    },
    getJz(e) {
      let arr = this.allEquList2.filter(item => item.hdNumber == e);
      let arr2 = arr.map(function(item) {
        return item.aircrewNumber;
      });
      this.JZnumberList = [...new Set(arr2)];
    },
    getMode(e){
      let arr = this.allEquList2.filter(item => item.hdNumber == this.formItem.hdNumber&&item.aircrewNumber == e)
      this.formItem.model=arr[0].model
    }
  },
  created() {
    this.getAllEqument();
    this.getAllPeople();
    this.getDataList();
    this.getEchartData()
  },
  mounted() {

  }
};
</script>

<style lang="less">
.testRecord {
  background: #fff;
  height: 100%;
  padding: 15px;
  font-size: 14px;
  .searchDiv {
    .marRight {
      margin-right: 15px;
    }
  }
  .ivu-form-item {
    margin-bottom: 15px;
  }
}
.baseTitle {
    font-weight: bold;
    font-size:16px;
    margin-bottom:10px;
  }
 .xzjz  {
   .ivu-form-item {
    margin-bottom: 10px;
  }
 }
 .chart{
   width: 100%;
 }
</style>
